<?php
/*
 * Creative Bulletin Board Generation 3
 * Version 1.0 Beta 1
 +------------------------------------
 * Login Application (Auth), Index/Form Module (Backend)
 * Started: 19 September, 2009 09:14 PM
 * Script version: 1.0
 +------------------------------------
 */

class module implements module_interface{
	public function returninitvars(){
		global $lang;
		$this->info["page_title"] = $lang->getByKey("admin.user.dashb");
		$this->info["page_description"] = "";
		$this->info["module_version"] = "1.0";
		return $this->info;
	}

	public function construct(){ # call our initialize functions
	}
	
	public function run(){
		global $view, $lang, $db, $models;
		$view->writeIn( $view->inlineInfo($lang->getByKey("admin.user.dashb.desc")));
		// Some nifty stats...
		$userQuery = $models['users']->select_all();
		$latestQuery = $models['users']->select_latest();
		$data1['numberOfUsers'] = $db->num_rows($userQuery);
		$groupQuery = $models['groups']->select_all();
		$permQuery = $models['permissionmasks']->select_all();
		$data1['numberOfGroups'] = $db->num_rows($groupQuery);
		$data1['numberOfPermMasks'] = $db->num_rows($permQuery);
		$data1['latestUsernameDisplay'] = $latestQuery['display'];
		$data1['latestUsername'] = $latestQuery['username'];
		$data1['latestJoined'] = $latestQuery['joined'];
		$view->writeIn($view->tablePadded(
			$lang->getByKey("admin.user.dashb.usst"),
			$view->showTemplate("stats", $data1),
			"group"
		));
	}

	public function destruct(){}
}
